import axios from "./request/http";
// export const outerBaseUrl = `http://172.18.26.114:8501/guanwang`;
export const outerBaseUrl = `https://cmdb.gzopendata.com/guanwang`;

export const outerPost = (method, params) => {
  let data = params;
  if (!params instanceof FormData) {
    data = JSON.stringify(params);
  }
  return axios({
    method: "GET",
    url: `${outerBaseUrl}${method}`,
    data
  }).then(res => {
    return Promise.resolve(res.data);
  });
};

export const outeGet = (method, params) => {
  return axios
    .get(`${outerBaseUrl}${method}`, {
      params
    })
    .then(res => {
      return Promise.resolve(res.data);
    });
};

export const shexiangtouGetCameraById = params => {
  return outeGet("/shexiangtou/getCameraById", params);
};
export const shexiangtouGetCameraByIdByHttps = params => {
  return outeGet("/shexiangtou/getCameraByIdByHttps", params);
};

export const shexiangtouClose = () => {
  return outeGet("/shexiangtou/close", {});
};

export const mozuGetDataByType = params => {
  return outeGet("/mozu/getDataByType", params);
};

export const mozuGetByName = params => {
  return outeGet("/mozu/getByName", params);
};

export const basicsGetData = params => {
  return outeGet("/basics/getData", params);
};

export const portGetPortDetail = params => {
  return outeGet("/port/getPortDetail", params);
};

/**
 * @name 获取所有机房数据
 * @param {Object} args 入参
 **/
export const jiFangDataGetAllList = params => {
  return outeGet("/jiFangData/getAllList", params);
};
